package work8;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class t3 {
    public static void main(String[] args) {
        Scanner s =new Scanner(System.in);
        System.out.println("请输入你的身份证号：");
        String temp = s.next();
        Pattern p1 = Pattern.compile("^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$");
        Matcher m = p1.matcher(temp);
        if(m.matches())
            System.out.println("输入身份证号合法");
        else
            System.out.println("输入身份证号错误");
        System.out.println("请输入你的邮箱：");
        temp = s.next();
        Pattern p2 = Pattern.compile("^[a-zA-Z0-9_]+@[a-zA-z0-9_]+\\.[a-z]{3,5}$");
        m =p2.matcher(temp);
        if (m.matches())
            System.out.println("输入邮箱正确");
        else
            System.out.println("输入邮箱错误！");
        System.out.println("\n0501刘冰");
    }
}
